<div ng-include="sys_html('common/_header')"></div>
<style>
.fui-btn-c {
    height: auto;
    background: #FF4444;
    margin: 0.6rem 0.3rem;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
	box-shadow: 0 8px 6px #1e970a;
    align-items: center;
	color:#fff;
    position: relative;
	border-radius:2rem;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.weui_cells_radio2 .weui_check:checked + .weui_icon_checked:before {
  color: #09ba07;
}
.fui-fullHigh-item.menu {
    width: 5.25rem;
    background: #fff;
	color: #333;
}
.fui-fullHigh-item.menu nav.on {
    background: #f5f5f5;
    color: #ffa000;
}
.fui-fullHigh-item.menu nav.on:before {
    border-left: 0 solid #ff5555;
}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category ul li.active a{color:#09ba07;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
.content-group {background:#fff;border-radius: 0.5rem;margin-bottom:0.39rem}
.merchname {display:none}
.carousel {margin-top:0}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.bottombg {position: absolute;width:100%;height:3.5rem;border-bottom-right-radius:100% 10rem;border-bottom-left-radius:100% 1rem;}
.fui-searchbar {padding-top:0.3rem;padding-bottom:0.3rem;margin-top:-2rem;height:auto;border-top-right-radius:1rem;border-top-left-radius:1rem;}
.searchbar .search-input input {
    height: 1.6rem;
}
.search-input i {
    line-height: 1.7rem;
}
.jylabels {
    display: inline;
    padding: 0 0.5rem;
    margin: 0.2rem;
    font-size: 0.55rem;
    line-height: 1.1rem;
    text-align: center;
    border-radius: 0.6rem;
}
.carousel {margin-top:0}
.fui-tab-scroll .item a {font-size:0.75rem;color:#999}
.fe-floatright-bottom .icon {
    display: block;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 100%;
    color: #fff;
    line-height: 1.6rem;
}
</style>
<div class="fui-page" ng-if="pagedata.isshowarea !=1">
	<div class="fui-content">
		<div class="topbg" style="position: relative;text-align:center;width:100%;height:4.5rem;background: #FF4444;">
			<div class="fui-header" style="background:none">
				<div class="fui-header-left" style="padding-left:0.5rem">
					<img style="height:1.4rem" ng-src="{{tomedia(pagedata.pluginset.logo) || '../addons/jy_weishop/resource/images/logo.png'}}"/>
				</div>
				<div class="title"></div>
				<div class="fui-header-right bold" ng-click="pagedata.isshowarea=1" style="padding-right:0.5rem;color:#fff">
					<i class="icon jinyunicon icon-map" style="font-size: 0.65rem;margin-right:10px">
						{{pagedata.pcd.street||'未获取地址'}}
					</i>
					<i class="icon jinyunicon icon-liaotian" ng-click="access_json('jy_merch/message/')" style="font-size: 1rem;"></i>
				</div>
			</div>
		</div>
		<div class="fui-searchbar bar" style="background:#fff;z-index: 0;">
					<div ng-class="{'searchbar':1,'searchbar-active':pagedata.searchbar ==1}" style="background:none">
							<div style="position: relative;left:0;top:0;">
								<div class="search-input" style="">
									<i id="searchsub" class="icon icon-sousuo1" ng-click="access_json('jy_city/search//keyword='+pagedata.params.keyword)"></i>
									<input type="search" placeholder="{{pagedata.pluginset.searchtitle ||'商家名称关键字'}}" class="search" ng-model="pagedata.params.keyword" style="text-align: left; color: #999; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;" />
								</div>
							</div>
					</div>
					<div class="row margin0">
							<div ng-repeat="(k,v) in pagedata.pluginset.searchkeyword" href="javascript:;" ng-click="access_json('jy_city/search//keyword='+v)" class="jylabels jylabel-f3f3f3" ng-click="pagedata.params.keyword=v">{{v}}</div>
					</div>
		</div>
		<!-- 滚动后出现 -->
		<div ng-if="showtopheader || pagedata.isgolist" class="fui-header searchtop" style="height:2.6rem;background:#fff">
			<div class="fui-header-left">
				<a class="back" href="javascript:" ng-click="goback()"></a>
			</div>
			<div class="fui-header-input" style="top:0.5rem;right:0.5rem">
				<div class="searchbar searchbar-active" style="margin-left:1.6rem">
						<div class="search-input" style="margin-right:0.5rem">
							<i id="searchsub" class="icon icon-sousuo1" ng-click="access_json('jy_city/search//keyword='+pagedata.params.keyword)"></i>
							<input type="search" placeholder="{{pagedata.pluginset.searchtitle ||'搜索商户'}}" class="search" ng-model="pagedata.params.keyword" style="text-align: left; color: #999; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;border: 0 solid #ddd;" />
						</div>
				</div>
			</div>
		</div>
		<!--<div class="fui-page-title" style="text-align:left">
			<div style="font-size:0.8rem">下午好，{{pagedata.member.nickname}}</div>
		</div>-->
		<div ng-include="sys_html('shop/_hdps','','','jy_weishop')" class="radius" style="padding:0 0.5rem;"></div>
		<div class="radius" style="padding: 0.5rem;width:100%;">
			<div ng-include="sys_html('common/_bankuai1')"></div>
		</div>
		<div class="fui-cube" href="javascript:;" ng-click="access_json(pagedata.pluginset.indexadurl)" style="padding:0 0.5rem;height:4rem">
			<img style="height:4rem;border-radius:0.5rem" ng-src="{{tomedia(pagedata.pluginset.indexad) || '../addons/jy_city/resource/images/indexad.jpeg'}}"/>
		</div>
		<div class="fui-tab-scroll" style="margin-top:0.4rem;padding-left:0.5rem">
			<div ng-class="{'item':1,'on':pagedata.params.order=='like'}" style="height:2rem;line-height:2rem"><a href="javascript:;" ng-click="pagedata.params.order='like';pagedata.getlist();">猜你喜欢</a></div>
			<div ng-class="{'item':1,'on':pagedata.params.order=='juli'}" style="height:2rem;line-height:2rem"><a href="javascript:;" ng-click="pagedata.params.order='juli';pagedata.getlist();">附近商家</a></div>
			<div ng-class="{'item':1,'on':pagedata.params.order=='star'}" style="height:2rem;line-height:2rem"><a href="javascript:;" ng-click="pagedata.params.order='star';pagedata.getlist();">发现好店</a></div>
			<div ng-class="{'item':1,'on':pagedata.params.order=='sale'}" style="height:2rem;line-height:2rem"><a href="javascript:;" ng-click="pagedata.params.order='sale';pagedata.getlist();">人气推荐</a></div>
		</div>
		<div class="fui-list-group merchgroup" style="background:none;">
				<div ng-include="sys_html('common/_merchlist')"></div>
				<div ng-if="!loading && (!pagedata.list || pagedata.list.length<1)" class='content-empty' style="margin-top:0">
					<i class='icon icon-lianxishangjia'></i>
					<div>暂时没有任何商家</div>
				</div>
		</div>
		<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
		<div ng-include="sys_html('common/_indexgoods')"></div>
		<div ng-include="sys_html('common/_copyright',true)"></div>
	</div>
</div>
<div ng-include="sys_html('common/_search')"></div>
<div ng-include="sys_html('common/_welcomehdp',true)"></div>
<script type="text/javascript">
scope.pagedata.post={'sendtype':1,'dayid':0}
scope.pagedata.getlist=function(type){
	scope.pagedata.isgolist = false;
	scope.pagedata.params.page=1;
	scope.loading=true;
	setTimeout(function(){
		scope.loading=false;
		scope.$evalAsync();
	},500);	
	if(type=='goods'){		
		scope.tool.get_list('jy_city/index/getgoods/',true)
	}else{
		scope.tool.get_list('jy_city/index/getmerchs/',true)
	}
}
scope.pagedata.getlist();
scope.pagedata.scroll_bottom=function(){
		if(scope.pagedata.showgoods){
			scope.tool.get_list('jy_city/index/getgoods/');
		}else{
			scope.tool.get_list('jy_city/index/getmerchs/');
		}
}
scope.pagedata.getgoods=function(type){
	scope.get('jy_city/index/getgoods/goodstype='+type,function(res){
		scope.pagedata.goods=res.list;
		scope.$evalAsync();
	});
}
scope.pagedata.getgoods('price');
scope.pagedata.golist=function(id,paramstype){
	scope.pagedata.isgolist = true;
	scope.pagedata.paramstype = paramstype;
	scope.$evalAsync();
}
</script>
<script>
	require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
	});
</script>
<script>
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.nowmsgid=0;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.pluginset.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.pluginset.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
</script>
<div ng-include="sys_html('common/_area')"></div>
<div ng-include="sys_html('common/pluginnav',true)"></div>
<div ng-include="sys_html('common/_coupon',true)"></div>
<div ng-include="sys_html('common/_gotop',true)"></div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_red','','','jy_merch')"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>